<template>
    <div id="warnStatistics" style="display: flex;">
        <div id="warnEct">

        </div>
        <div id="warnText">
            <div class="warnTextbox">
                <h3>全部告警</h3>
                <p><span>79701</span>条</p>
            </div>
            <div class="warnTextbox">
                <h4>本周告警</h4>
                <p><span>152</span>条</p>
            </div>
        </div>
    </div>
</template>
<script>
import * as echarts from 'echarts';
export default {
    methods: {
        //告警统计
        warnStatistics() {
            var warnEct = document.getElementById('warnEct');
            var myChart = echarts.init(warnEct);
            var option;
            option = {
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                        type: 'cross',
                        label: {
                            backgroundColor: '#6a7985'
                        }
                    }
                },


                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '26%',
                    top: '10%',
                    containLabel: true
                },
                xAxis: [
                    {
                        type: 'category',
                        boundaryGap: false,
                        splitNumber: 7,
                        data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
                    }
                ],
                yAxis: [
                    {
                        type: 'value'
                    }
                ],
                series: [
                    {
                        name: '告警统计',
                        type: 'line',
                        stack: 'Total',
                        // color: ['#d74b0c', '#fdb901', '#ef6a0b'],//线条颜色
                        // backgroundColor: "#5c1823",
                        TextColor: ['#d4710d'],
                        areaStyle: {

                        },
                        emphasis: {
                            focus: 'series'
                        },
                        itemStyle: {
                            normal: {
                                label: {
                                    show: true //文字提示
                                },
                                lineStyle: {
                                    color: ['#d74b0c', '#fdb901', '#ef6a0b']// 折线颜色设置为0，即只显示点，不显示折线
                                }
                            }
                        },

                        data: [120, 132, 101, 134, 90, 230, 210]
                    }
                ]
            };
            window.addEventListener("resize", function () {
                myChart.resize()
            })
            option && myChart.setOption(option);
        }
    },
    mounted() {
        this.warnStatistics()
    }
}
</script>

<style lang="scss" scoped>
#warnStatistics {
    width: 100%;
    height: 100%;

    #warnEct {
        width: 24.375rem;
        height: 100%;
    }
}
</style>
